package com.syq.controller;

import com.syq.annotation.RequiresPermissionsDesc;
import com.syq.service.DtsOrderService;
import com.syq.vo.CatVo;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: AdminOrderController
 * @Description: TODO
 * @Create by: syq
 * @Date: 2022/7/28 11:41
 */

@RestController
@CrossOrigin
@RequestMapping("/admin/order")
public class AdminOrderController {

    @Autowired
    private DtsOrderService dtsOrderService;

    @RequiresPermissionsDesc(menu = {"商场管理","订单管理"},button = "查询")
    @RequiresPermissions(value = "admin:order:list")
    @GetMapping("/list")
    public Object orderList(@RequestParam(defaultValue = "1") Integer page,
                           @RequestParam(defaultValue = "10") Integer limit, Integer orderSn,Integer[] orderStatusArray,Integer userId,
                           @RequestParam(defaultValue = "add_time") String sort,
                           @RequestParam(defaultValue = "desc") String order){
        return dtsOrderService.findAll(page,limit,sort,order,orderSn,userId,orderStatusArray);
    }

    @GetMapping("/listShipChannel")
    public Object listShipChannel(){

        return null;
    }

    @RequiresPermissionsDesc(menu = {"商场管理","订单管理"},button = "订单详情")
    @RequiresPermissions(value = "admin:order:detail")
    @GetMapping("/detail")
    public Object detail(Integer id){
        return dtsOrderService.findById(id);
    }
}
